package edu.unf.cen6940.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.LinkedHashSet;
import java.util.Set;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllThesistools", query = "select myThesistool from Thesistool myThesistool"),
		@NamedQuery(name = "findThesistoolByPrimaryKey", query = "select myThesistool from Thesistool myThesistool where myThesistool.thesisToolId = ?1"),
		@NamedQuery(name = "findThesistoolByThesisToolId", query = "select myThesistool from Thesistool myThesistool where myThesistool.thesisToolId = ?1"),
		@NamedQuery(name = "findThesistoolByToolDescription", query = "select myThesistool from Thesistool myThesistool where myThesistool.toolDescription = ?1"),
		@NamedQuery(name = "findThesistoolByToolDescriptionContaining", query = "select myThesistool from Thesistool myThesistool where myThesistool.toolDescription like ?1") })
@Table(catalog = "ThesisManagement", name = "ThesisTool")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "rms_test/edu/unf/cen6940/domain", name = "Thesistool")
public class Thesistool implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "thesisToolID", nullable = false)
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	Integer thesisToolId;
	/**
	 */

	@Column(name = "toolDescription", length = 1024, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String toolDescription;

	/**
	 */
	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(catalog = "ThesisManagement", name = "ThesisToThesisTool", joinColumns = { @JoinColumn(name = "thesisToolID", referencedColumnName = "thesisToolID", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "thesisID", referencedColumnName = "thesisID", nullable = false, updatable = false) })
	@XmlElement(name = "", namespace = "")
	java.util.Set<edu.unf.cen6940.domain.Thesis> thesises;

	/**
	 */
	public void setThesisToolId(Integer thesisToolId) {
		this.thesisToolId = thesisToolId;
	}

	/**
	 */
	public Integer getThesisToolId() {
		return this.thesisToolId;
	}

	/**
	 */
	public void setToolDescription(String toolDescription) {
		this.toolDescription = toolDescription;
	}

	/**
	 */
	public String getToolDescription() {
		return this.toolDescription;
	}

	/**
	 */
	public void setThesises(Set<Thesis> thesises) {
		this.thesises = thesises;
	}

	/**
	 */
	public Set<Thesis> getThesises() {
		if (thesises == null) {
			thesises = new java.util.LinkedHashSet<edu.unf.cen6940.domain.Thesis>();
		}
		return thesises;
	}

	/**
	 */
	public Thesistool() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(Thesistool that) {
		setThesisToolId(that.getThesisToolId());
		setToolDescription(that.getToolDescription());
		setThesises(new java.util.LinkedHashSet<edu.unf.cen6940.domain.Thesis>(that.getThesises()));
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("thesisToolId=[").append(thesisToolId).append("] ");
		buffer.append("toolDescription=[").append(toolDescription).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((thesisToolId == null) ? 0 : thesisToolId.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof Thesistool))
			return false;
		Thesistool equalCheck = (Thesistool) obj;
		if ((thesisToolId == null && equalCheck.thesisToolId != null) || (thesisToolId != null && equalCheck.thesisToolId == null))
			return false;
		if (thesisToolId != null && !thesisToolId.equals(equalCheck.thesisToolId))
			return false;
		return true;
	}
}
